Skip to content

Add PrecompileTools workload to improve startup time#19

Merged
ChrisRackauckas merged 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:precompile-improvements-20260107-185513
Jan 8, 2026
Merged

Add PrecompileTools workload to improve startup time#19
ChrisRackauckas merged 1 commit into
SciML:mainfrom
ChrisRackauckas-Claude:precompile-improvements-20260107-185513

Conversation

@ChrisRackauckas-Claude

Copy link
Copy Markdown
Member

Summary

  • Add PrecompileTools.jl as a dependency
  • Add precompilation workload for common entry points (FVMGeometry, boundary conditions, FVMProblem, ODEProblem)
  • Improves time-to-first-execution (TTFX) by 84%

Timing Measurements (Julia 1.10)

Before

Metric Time
Package load time 1.046s
First FVMGeometry 0.108s
First BoundaryConditions 0.009s
First FVMProblem 0.065s
First ODEProblem 0.451s
Total TTFX 0.633s

After

Metric Time Improvement
Package load time 1.068s -
First FVMGeometry ~0s 99%
First BoundaryConditions ~0s 99%
First FVMProblem 0.063s -
First ODEProblem 0.036s 92%
Total TTFX 0.1s 84%

Note: FVMProblem TTFX is unchanged because user-provided functions (like diffusion_function) require runtime compilation - this is expected behavior.

Technical Details

  • Precompilation time increased from ~2s to ~3s, which is acceptable given the significant TTFX improvements
  • No invalidations were found from this package. The few invalidations detected during load come from dependencies (RecursiveArrayTools, SciMLBase, etc.)
  • The precompilation workload uses minimal mesh sizes (10 points) to keep precompilation time low

Test plan

  • Package loads correctly
  • FVMProblem creation works
  • ODEProblem creation works
  • CI tests should pass (note: some image comparison tests may fail due to environment differences, unrelated to this PR)

cc @ChrisRackauckas

🤖 Generated with Claude Code

Add a precompilation workload using PrecompileTools.jl that precompiles
the most common entry points:
- FVMGeometry creation
- Dirichlet and Neumann boundary conditions
- BoundaryConditions combinations
- FVMProblem creation
- ODEProblem creation from FVMProblem
- jacobian_sparsity

Timing improvements (tested with Julia 1.10):

Before:
- Package load time: 1.046 seconds
- First FVMGeometry: 0.108 seconds
- First BoundaryConditions: 0.009 seconds
- First FVMProblem: 0.065 seconds
- First ODEProblem: 0.451 seconds
- Total TTFX: 0.633 seconds

After:
- Package load time: 1.068 seconds
- First FVMGeometry: ~0 seconds (99% improvement)
- First BoundaryConditions: ~0 seconds (99% improvement)
- First FVMProblem: 0.063 seconds (no change, expected due to user functions)
- First ODEProblem: 0.036 seconds (92% improvement)
- Total TTFX: 0.1 seconds (84% improvement)

Precompilation time increased from ~2s to ~3s, which is acceptable given
the TTFX improvements.

Note: No invalidations were found from this package. The few invalidations
detected during load come from dependencies (RecursiveArrayTools, SciMLBase).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ChrisRackauckas
ChrisRackauckas merged commit bca59e1 into SciML:main Jan 8, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants